{% extends "base.volt" %}
        {% block pageHeader %}
        {{ stylesheet_link("/libs/bootstrap-daterangepicker/daterangepicker.css", false) }}
        {% endblock %}

{% block pageFooter%}
{{ javascript_include("/js/area.js", false) }}
{{ javascript_include("/libs/bootstrap-daterangepicker/moment.min.js", false) }}
    {{ javascript_include("/libs/bootstrap-daterangepicker/daterangepicker.js", false) }}
{{ javascript_include("/assets/manage/js/bp/update.js", false) }}
        {{ javascript_include("/libs/UEditor/utf8-php/ueditor.config.js", false) }}
        {{ javascript_include("/libs/UEditor/utf8-php/ueditor.all.min.js", false) }}
        {{ javascript_include("/libs/UEditor/utf8-php/lang/zh-cn/zh-cn.js", false) }}
		{{ javascript_include("/assets/manage/js/beautycanon/list_edit_base.js", false) }}
{% endblock %}

{% block content %}
{{ partial("module/left_bp") }}
<div class="col-xs-10">
    <ol class="breadcrumb">
        <li><a href="{{ url.get('bp/list') }}">美容院</a></li>
        <li><a href="{{ url.get('bp/list') }}">美容院管理</a></li>
        <li class="active">更新美容院信息</li>
        <li class="active pull-right"><button type="button" onclick="history.back()" class="btn btn-primary btn-xs"><i class="fa fa-chevron-left"></i> 返回</button></li>
    </ol>
    <form id="form_update" class="form-horizontal" role="form" method="post" action="" target="ifr_send_file" enctype="multipart/form-data" durl="{{ url.get('bp/list') }}">
        <input type="hidden" name="callback" value="parent.formResult" >
        <input type="hidden" name="bp_id" id="bp_id" value="{{ id }}" />
        <div class="form-group">
            <label for="bp_name" class="col-xs-2 control-label">名称</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="bp_name" name="bp_name" value="{{ bpInfo.bp_name|escape_attr }}" data-rule="required;">
            </div>
        </div>
        <div class="form-group">
            <label for="bp_cover" class="col-xs-2 control-label">封面</label>
            <div class="col-xs-9">
                <div id="box_cover_show">
                    <img src="{{ PicUrlBPCover(bpInfo.bp_cover, this.di) }}@!90" />
                    <button type="button" class="btn btn-warning btn-xs but_update" id="but_cover_update"><i class="fa fa-pencil"></i></button>
                </div>
                <p class="help-block">*支持JPG，PNG，JPEG格式的图片，大小不超过1M，尺寸为：750X260px</p>
                <div class="row hide" id="box_cover_update"></div>
            </div>
        </div>
        <div class="form-group">
            <label for="bp_district" class="col-xs-2 control-label">城市</label>
            <div class="form-inline col-xs-9">
                <div class="input-group">
                    <label class="input-group-addon">省</label>
                    <select class="form-control" id="bp_province" dvalue="{{ bpArea.P_NM|escape_attr }}">
                        <option value="">请选择...</option>
                    </select>
                    <label class="input-group-addon">市</label>
                    <select class="form-control" id="bp_city" dvalue="{{ bpArea.C_NM|escape_attr }}">
                        <option value="">请选择...</option>
                    </select>
                    <label class="input-group-addon">区/县</label>
                    <select class="form-control" name="bp_district" id="bp_district" dvalue="{{ bpInfo.bp_district }}" data-rule="required(not, -10000);" data-target="#bp_district_error">
                        <option value="-10000">请选择...</option>
                    </select>
                </div>
                <div class="input-group" id="bp_district_error"></div>
            </div>
        </div>
        <div class="form-group">
            <label for="bp_address" class="col-xs-2 control-label">地址</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="bp_address" name="bp_address" value="{{ bpInfo.bp_address|escape_attr }}" data-rule="required;">
            </div>
        </div>
        <div class="form-group">
            <label for="bp_coordinate" class="col-xs-2 control-label">地理坐标</label>
            <div class="form-inline col-xs-9">
                <div class="input-group paddingTB5">
                    <input type="text" class="form-control" id="bp_coordinate" name="bp_coordinate" value="{{ bpInfo.latitude }},{{ bpInfo.longitude }}"  readonly="readonly" data-rule="required;" data-target="#bp_coordinate_error">
                    <div class="input-group-addon bg_337ab7 cursor_pointer" id="but_map_select" durl="{{ url.get('tools/map') }}"><i class="fa fa-map-marker"></i> 选择...</div>
                </div>
                <div class="input-group" id="bp_coordinate_error"></div>
            </div>
        </div>
        <div class="form-group">
            <label for="bp_tel" class="col-xs-2 control-label">电话</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="bp_tel" name="bp_tel" value="{{ bpInfo.bp_tel|escape_attr }}">
            </div>
        </div>
        <div class="form-group">
            <label for="bp_is_sell" class="col-xs-2 control-label">是否销售</label>
            <div class="col-xs-9">
                <div class="radio">
                    <label>
                        <input type="radio" name="bp_is_sell" id="bp_is_sell_1" value="1" {{ bpInfo.bp_is_sell == 1 ? 'checked="checked"' : '' }}> 是
                    </label>
                    <label>
                        <input type="radio" name="bp_is_sell" id="bp_is_sell_0" value="0" {{ bpInfo.bp_is_sell != 1 ? 'checked="checked"' : '' }}> 否
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="bp_is_sell" class="col-xs-2 control-label">勋章</label>
            <div class="col-xs-9">
                <div class="checkbox">
                    <!-- <label>
                        <input type="checkbox" name="bp_medal_refund" id="bp_medal_refund" value="1" {{ BPMedalRefund(bpInfo.bp_medal) == 1 ? 'checked="checked"' : '' }}> 退款保障
                    </label> -->
                    <label>
                        <input type="checkbox" name="bp_medal_verify" id="bp_medal_verify" value="1" {{ BPMedalVerify(bpInfo.bp_medal) == 1 ? 'checked="checked"' : '' }}> 深度验店
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="low_price" class="col-xs-2 control-label">起步价</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="low_price" name="low_price" value="{{ bp_attr['low_price'] }}"  style="width:200px; display:inline;" data-rule="required;"> 元起
            </div>
        </div>
        <div class="form-group">
            <label for="open_year" class="col-xs-2 control-label">开业年限</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="open_year" name="open_year" value="{{ bp_attr['open_year'] }}" style="width:200px; display:inline;" data-rule="required;"> 年
            </div>
        </div>
        <div class="form-group">
            <label for="shop_area" class="col-xs-2 control-label">店铺面积</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="shop_area" name="shop_area" value="{{ bp_attr['shop_area'] }}" style="width:200px; display:inline;" data-rule="required;"> m²
            </div>
        </div>
        <div class="form-group">
            <label for="shop_area" class="col-xs-2 control-label">项目</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="service_num" name="service_num" value="{{ bp_attr['service_num'] }}" style="width:200px; display:inline;" data-rule="required;"> 项
            </div>
        </div>
        <div class="form-group">
            <label for="shop_area" class="col-xs-2 control-label">设备设施</label>
            <div class="col-xs-9 form-inline">
                <div id="checks">
                    <label class="checkbox-inline">
                        <input type="checkbox" name="facilities[]" value="wifi" {% for r in facilitiesArr %} {% if r=='wifi' %} checked="checked"  {% endif %}{% endfor %}> WIFI
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="facilities[]" value="停车" {% for r in facilitiesArr %} {% if r=='停车' %} checked="checked"  {% endif %}{% endfor %}> 停车
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="facilities[]" value="洗浴" {% for r in facilitiesArr %} {% if r=='洗浴' %} checked="checked"  {% endif %}{% endfor %}> 洗浴
                    </label>
                </div>

                <div id="delBox">
                	{% for r in facilitiesArr%}
                	{% if r != 'wifi' and r != '停车' and r != '洗浴'%}
                	<div class="input-group">
                		<input type="text" class="form-control del_equipmentText" name="facilities[]" readonly value="{{ r }}">
                		<div class="input-group-addon bg_337ab7 cursor_pointer del_equipment"><i class="fa fa-trash-o"></i> 删除</div>
                	</div>
                	{% endif %}
                	{% endfor %}
                </div>
                <div class="input-group paddingTB5">
                    <input type="text" class="form-control" id="add_equipmentText" name="">
                    <div class="input-group-addon bg_337ab7 cursor_pointer" id="add_equipment" ><i class="fa fa-plus"></i> 添加</div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="time" class="col-xs-2 control-label">营业时间</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="time" name="time" value="{{ bp_attr['open_time'] }} 至 {{ bp_attr['close_time'] }}" data-rule="required;">
            </div>
        </div>
        <div class="form-group">
            <label for="bp_tags" class="col-xs-2 control-label">标签</label>
            <input type="hidden" name="bp_tags" id="bp_tags" value="{{ tagList[0] }}">
            <div class="form-inline col-xs-9">
                <div class="input-group">
                    <input type="text" class="form-control" id="bp_tags_view" value="{{ tagList[1] }}" readonly="readonly" data-rule="required;" data-target="#bp_tags_error">
                    <div class="input-group-addon bg_337ab7 cursor_pointer" id="but_tags_select" durl="{{ url.get('bptag/layer') }}"><i class="fa fa-tag"></i> 选择...</div>
                </div>
                <div class="input-group" id="bp_tags_error"></div>
            </div>
        </div>
        <div class="form-group">
            <label for="bp_photos" class="col-xs-2 control-label">轮播图片</label>
            <div class="col-xs-9">
                <div class="row">
                    {% for pic in picList %}
                    <div class="col-xs-3" id="bp_photo_{{ pic.photo_id }}">
                        <a href="{{ PicUrlBPPic(pic.photo_url, this.getDi()) }}" class="thumbnail" target="_blank">
                            <img src="{{ PicUrlBPPic(pic.photo_url, this.getDi()) }}" alt="" />
                        </a>
                        <button type="button" class="btn btn-danger btn-sm photo_delete_but" dhref="{{ url.get('bp/deletePhoto') }}" did="{{ pic.photo_id }}"><i class="fa fa-trash-o"></i></button>
                    </div>
                    {% endfor %}
                </div>
                <div id="bp_photos_box"></div>
                <div>
                    <p class="help-block pull-left">*支持JPG，PNG，JPEG格式的图片，大小不超过1M，尺寸为：750X350px</p>
                    <button type="button" id="but_add_photo" class="btn btn-primary btn-sm pull-right"><i class="fa fa-plus"></i></button>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="bp_owner_mobile" class="col-xs-2 control-label">店长电话</label>
            <div class="col-xs-9">
                <input type="text" class="form-control" id="bp_owner_mobile" name="bp_owner_mobile" data-rule="required; integer[+]; length[11];" value="{{ bpInfo.bp_owner_mobile }}">
            </div>
        </div>
        <div class="form-group">
            <label for="bp_is_sell" class="col-xs-2 control-label">介绍</label>
            <div class="col-xs-9">
            
                <textarea id="editor" name="bp_intro" id="bp_intro" rows="15" style="height:300px;" data-rule="required;">{{ bpInfo.bp_intro|e }}</textarea>
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 text-center">
                <button type="submit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> 保 存</button>
            </div>
        </div>
    </form>
</div>

{% endblock %}